#ifndef PARSER_H
#define PARSER_H
#include <stdio.h>
#include "dict.h"
#include <set>

enum States
{
   BEGIN_STATE,
   IN_IDENTIFIER,
   IN_COMMENT,
   IN_STRING,
   BEFORE_COMMENT,
   AFTER_COMMENT,
   END
};

enum Symbols
{
   LETTER,
   DIGIT,     //жхтпю
   UNDERLINE,
   SLASH,
   GEAR,    //гбегднвйю
   QUOTES,  //йюбшвйх
   SEPARATIONS, //пюгдекхрекэмши яхлбнк ();
   LINE_END   //яхлбнк оепеундю ярпнйх
};


struct Parser
{
   private:
      FILE * input_file_;
      char  input_file_name_[1024];
      char current_string_[1024];  // временная штука
      unsigned int number_of_string_;
      char *  current_symbol_;
      States current_state_;
      char * begin_identifier_;
      set <string> unic_words_;
      float bad_ident_;
      int print_errors_;


      Symbols returnSymbolType (char symbol);

      States beginState ( Symbols symbol_type );
      States inIdentifier ( Symbols symbol_type);
      States inComment (Symbols symbol_type);
      States inString (Symbols symbol_type);
      States beforeComment (Symbols symbol_type);
      States afterComment (Symbols symbol_type);
      bool workUp ();

   public:
      Dict D_;
      Parser(FILE * main_dict);
      set <string> & runParser();
      void notPrintError();
      bool setInputFile (FILE * input_file, const char * file_name);
   };

   #endif

